home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / info.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  3KB  |  87 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /*  Info.c  */
  21.  
  22. #include <externs.h>
  23.  
  24.  
  25. unsigned AVL_NBYTES()
  26. {
  27.     AVL_EDIT_WINDOW_PTR w;
  28.     AVL_LINE_PTR temp;
  29.     unsigned n = 0;
  30.     w = &avl_windows[avl_window];
  31.     for (temp = w -> head -> next; temp != w -> head; temp = temp -> next)
  32.         n += (strlen(temp -> line) + 1);
  33.     if ((w -> head -> previous -> line_no == 2) &&
  34.         (strlen(w -> head -> next -> line) == 0)) --n;
  35.     return n;
  36. }
  37.  
  38. void AVL_ABOUT_GWADA() 
  39. {  
  40.     struct diskfree_t *dks;
  41.     short co;
  42.     int n, k;
  43.     char line[180];
  44.     char l2[100];
  45.     AVL_WIN_PTR w;
  46.     sprintf(line," Info - GWAda V %s - By A. V. Lopes & M. B. Feldman ",GWAda_Version);
  47.     n = strlen(line) + 2;
  48.     k = (80 - n) / 2;
  49.     w = AVL_MAKE_WINDOW(line,5,k,14+5,k+n+2,avl_wnd_bk_color,avl_wnd_color);
  50.     _settextposition(2,2);
  51.     sprintf(line,"Current drive and directory: %s", avl_curr_directory);
  52.     _outtext(line);
  53.     _settextposition(3,2);
  54.     sprintf(line,"Source directory           : %s", avl_dir_sources);
  55.     _outtext(line);
  56.     _settextposition(4,2);
  57.     sprintf(line,"Library directory          : %s", avl_dir_library);
  58.     _outtext(line);
  59.  
  60.     _settextposition(6,2);
  61.     if (_dos_getdiskfree(0,dks) != 0)  
  62.         sprintf(line,"Disk space available       : unknown");
  63.     else
  64.         sprintf(line,"Disk space available       : %ldKb",
  65.             (((dks -> bytes_per_sector * 1L) *  
  66.                dks -> sectors_per_cluster) * dks -> avail_clusters) / 1024L);
  67.     _outtext(line);
  68.     _settextposition(7,2);
  69.     sprintf(line,"Extended memory available  : %ldKb", _memavl() / 1024L);
  70.     _outtext(line);
  71.     _settextposition(8,2);
  72.     sprintf(line,"Active text file name      : %s", avl_windows[avl_window].file_name);
  73.     _outtext(line);
  74.     _settextposition(9,2);
  75.     sprintf(line,"     No. of text lines     : %d", 
  76.         avl_windows[avl_window].head -> previous -> line_no - 1);
  77.     _outtext(line);
  78.     _settextposition(10,2);
  79.     sprintf(line,"     No. of text characters: %u", AVL_NBYTES());
  80.     _outtext(line);
  81.     _settextposition(12,2);
  82.     _settextcolor(9);
  83.     _outtext("Press any key to return to top menu...");
  84.     if ((k = getch()) == 0) k = getch();
  85.     AVL_DEL_WINDOW(w);
  86. }
  87.